-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add: Result collector #1574
Merged
Merged
Add: Result collector #1574
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Also, improve the creating the RedisHelper, since at this point the nvti cache and a main kb for the scan should have been created. Usage example. (Needs a running redis instance with an up-to-date nvticache) ``` ```use std::sync::{Arc, Mutex}; use models::{AliveTestMethods, Credential, PortRange, Port, Scan, Parameter}; use openvas::{pref_handler::PreferenceHandler, openvas_redis::RedisHelper}; use redis_storage::{NameSpaceSelector, RedisCtx}; async fn main() -> Result<(), std::fmt::Error> { // Create an scan config let mut scan = Scan::default(); scan.scan_id = Some("123-456".to_string()); scan.target.alive_test_methods = vec![AliveTestMethods::Icmp, AliveTestMethods::TcpSyn]; scan.target.credentials = vec![Credential { service: models::Service::SSH, port: Some(22), credential_type: models::CredentialType::UP { username: "user".to_string(), password: "pass".to_string(), privilege_credential: None, }, }]; scan.vts.push(models::VT { oid: "1.3.6.1.4.1.25623.1.0.112771".to_string(), parameters: vec![Parameter { id: 1, value: "llala".to_string() }] }); scan.target.excluded_hosts = vec!["127.0.0.1".to_string()]; scan.target.hosts = vec!["127.0.0.2".to_string()]; scan.target.ports = vec![Port { protocol: Some(models::Protocol::TCP), range: vec![ PortRange { start: 22, end: Some(25), }, PortRange { start: 80, end: None, }, ], }]; let redis_url = "unix:///run/redis-openvas/redis.sock"; // In this example, a fix db is taken,but the next free can be taken, using the name space selector NameSpaceSelector::Free let mut rctx = RedisCtx::open(redis_url, &[NameSpaceSelector::Fix(6)]).unwrap(); rctx.delete_namespace().unwrap(); // Create a redis connection to the nvticache, and a connection to the mainkb(). let cache = RedisCtx::open(redis_url, &[NameSpaceSelector::Key("nvticache")]).unwrap(); // New redis helper with access to the main kb for storing the preferences, and access to the nvticache // for getting info to build preferences. let rc = RedisHelper::<RedisCtx>::init(Arc::new(Mutex::new(cache)),Arc::new(Mutex::new(rctx))).unwrap(); let mut p = PreferenceHandler::new(scan, rc); Ok(p.prepare_preferences_for_openvas().await.expect("aaa")) }
Depends on #1572 |
jjnicola
force-pushed
the
result-collector
branch
4 times, most recently
from
February 20, 2024 13:41
e43354c
to
64f4351
Compare
Collects results from redis and return a structure with a list of results and the amount of dead host and total amount of alive hosts
jjnicola
force-pushed
the
result-collector
branch
from
February 20, 2024 14:25
64f4351
to
e673885
Compare
jjnicola
force-pushed
the
result-collector
branch
from
February 22, 2024 08:03
ca05b6f
to
5be07b5
Compare
nichtsfrei
reviewed
Feb 22, 2024
nichtsfrei
previously approved these changes
Feb 22, 2024
jjnicola
force-pushed
the
result-collector
branch
from
February 26, 2024 10:35
ed1afba
to
85fecfc
Compare
nichtsfrei
approved these changes
Feb 26, 2024
ArnoStiefvater
approved these changes
Feb 27, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What:
Add: retrieve from redis the host progress/status and scan results
Jira: SC-1002
Why:
How:
Checklist: